package dao.impl;

import java.sql.SQLException;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.BeanHandler;


import dao.MessageDao;
import entity.Product_Comment;
import util.C3P0Util;

public class MessageDaoImpl implements MessageDao{

	@Override
	public boolean getMessage(Product_Comment pc) {
		int i=0;
		boolean flag=false;
		QueryRunner qr = new QueryRunner(C3P0Util.getDataSource());
		 
		String sql = "INSERT INTO `product_comment` VALUES(null,?,?,?,?,?,?,?,?,?)";
		Object[] c = {pc.getProduct_id(),pc.getOrder_id(),pc.getUser_id(),
				pc.getTitle(),pc.getContent(),pc.getAudit_status(),pc.getAudit_time(),pc.getModified_time(),pc.getModel_id()};											
		try {
			i = qr.update(sql, c);	
		if (i>0) {
			flag=true;
		}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		return flag;
	}

}
